package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.dao.CmCaseBatchMapper;
import com.cm.caseManagement.pojo.entity.CmCaseBatch;
import com.cm.caseManagement.service.ICmCaseBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 案件批次Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmCaseBatchServiceImpl implements ICmCaseBatchService
{
    @Autowired
    private CmCaseBatchMapper cmCaseBatchMapper;

    /**
     * 查询案件批次
     *
     * @param id 案件批次主键
     * @return 案件批次
     */
    @Override
    public CmCaseBatch selectCmCaseBatchById(Long id)
    {
        return cmCaseBatchMapper.selectCmCaseBatchById(id);
    }

    /**
     * 查询案件批次列表
     *
     * @param cmCaseBatch 案件批次
     * @return 案件批次
     */
    @Override
    public List<CmCaseBatch> selectCmCaseBatchList(CmCaseBatch cmCaseBatch)
    {
        return cmCaseBatchMapper.selectCmCaseBatchList(cmCaseBatch);
    }

    /**
     * 新增案件批次
     *
     * @param cmCaseBatch 案件批次
     * @return 结果
     */
    @Override
    public int insertCmCaseBatch(CmCaseBatch cmCaseBatch)
    {
        cmCaseBatch.setCreateTime(DateUtils.getNowDate());
        return cmCaseBatchMapper.insertCmCaseBatch(cmCaseBatch);
    }

    /**
     * 修改案件批次
     *
     * @param cmCaseBatch 案件批次
     * @return 结果
     */
    @Override
    public int updateCmCaseBatch(CmCaseBatch cmCaseBatch)
    {
        cmCaseBatch.setUpdateTime(DateUtils.getNowDate());
        return cmCaseBatchMapper.updateCmCaseBatch(cmCaseBatch);
    }

    /**
     * 批量删除案件批次
     *
     * @param ids 需要删除的案件批次主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseBatchByIds(Long[] ids)
    {
        return cmCaseBatchMapper.deleteCmCaseBatchByIds(ids);
    }

    /**
     * 删除案件批次信息
     *
     * @param id 案件批次主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseBatchById(Long id)
    {
        return cmCaseBatchMapper.deleteCmCaseBatchById(id);
    }
}
